#ifndef _DELAY_H_
#define _DELAY_H_

#include "main.h"


#define DELAY_US 2

/**
 * @if Eng 
 * @brief Initializes the delay function timing system
 * @param None 
 * @result Delay timing system is ready for use 
 * @note Must be called before using delay_ms() or delay_us()
 * @else
 * @brief 初始化延时函数计时系统
 * @param 无
 * @result 延时计时系统准备就绪 
 * @note 在使用delay_ms()或delay_us()前必须调用 
 * @endif 
 */
void delay_init(void);

/**
 * @if Eng 
 * @brief Creates a millisecond-level delay
 * @param nms - Number of milliseconds to delay (1-65535)
 * @result Execution is paused for specified milliseconds 
 * @note Accuracy depends on system clock configuration 
 * @else 
 * @brief 创建毫秒级延时 
 * @param nms - 延时的毫秒数(1-65535)
 * @result 执行暂停指定的毫秒数 
 * @note 精度取决于系统时钟配置 
 * @endif 
 */
void delay_ms(uint16_t nms);

/**
 * @if Eng 
 * @brief Creates a microsecond-level delay 
 * @param nus - Number of microseconds to delay (1-4294967295)
 * @result Execution is paused for specified microseconds
 * @note Minimum delay time depends on CPU clock speed 
 * @else 
 * @brief 创建微秒级延时 
 * @param nus - 延时的微秒数(1-4294967295)
 * @result 执行暂停指定的微秒数
 * @note 最小延时时间取决于CPU时钟速度
 * @endif 
 */
void delay_us(uint32_t nus);

#endif
